package com.javachamp.exceptions;

import java.io.IOException;

/**
 * 
 * @author 0guzhan.blogspot.com
 * */
public class InterfaceWithException {

	interface Foldable {
		public void fold() throws IOException;

	}

	static class Paper implements Foldable {
		public void fold() { // line X - throw declaration is optional
			System.out.print("Fold");
		}
	}

	public static void main(String args[]) {
		Foldable obj1 = new Paper();
		try {
			obj1.fold(); // line Y - looking Paper instance from Foldable interface 
						 // thus it must be handled 
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		Paper obj2 = new Paper(); 
		obj2.fold(); // line 10 - Paper class doesn't declare an eception; thus it valid.
	}
}
